package day05;
import java.util.Arrays;
public class ArrayDemo {
    public static void main(String[] args) {
        int[] arr = new int[6];
        for (int i = 0;i<arr.length;i++){
            arr[i] = (int)(Math.random()*100);
            System.out.println(arr[i]);
        }
        Arrays.sort(arr);
        System.out.println("排序后:");
        for (int i = 0;i<arr.length;i++){
            System.out.println(arr[i]);
        }
        System.out.println("倒着输出");
        for (int i =arr.length-1;i>=0;i--){
            System.out.println(arr[i]);

        }


















        /*
        int[] arr = new int[10];
        for (int i = 0;i<arr.length;i++){
            arr[i]=(int)(Math.random()*100);
            System.out.println(arr[i]);


        }



*/


















        /*
        int[] a = new int[6];
        System.out.println("数组的长度为"+a.length);
        a[0]=6;
        a[1]=66;
        a[2]=666;
        a[3]=6666;
        a[4]=66666;
        a[5]=666666;
        System.out.println(a[2]);
        System.out.println(a[a.length-1]);

        int[] b = new int[3];
        System.out.println("数字长度为"+b.length);
        b[0]=10;
        b[1]=20;
        b[2]=30;
       // b[3]=40;运行错误
        System.out.println(b[b.length-1]);

         */

















        /*
        int[] a = new int[5];
        double[] b = new double[6];
        boolean[] c = new boolean[7];
        byte[] d = new byte[8];
        float[] e = new float[9];
        char[] f = new char[10];
        short[] g = new short[11];
        long[] h = new long[12];

        int[] a1 = new int[3];
        int[] a2 ={6,6,6};
        int[] a3 =new int[]{6,6,6};
        int[] a4;
        a4 = new int[]{6,6,6};

         */






    }
}
